#include <bits/stdc++.h>
using namespace std;
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
using ll = long long;

void solve()
{
    ll n1, n2, n3;
    cin >> n1 >> n2 >> n3;
    vector<ll> t_n1(n1 + 1), t_n2(n2 + 1), t_n3(n3 + 1);
    for (ll i = 1; i <= n1; i++)
        cin >> t_n1[i];
    for (ll i = 1; i <= n2; i++)
        cin >> t_n2[i];
    for (ll i = 1; i <= n3; i++)
        cin >> t_n3[i];

    int st_hh, st_mm, ed_hh, ed_mm;
    scanf("%d:%d", &st_hh, &st_mm);
    scanf("%d:%d", &ed_hh, &ed_mm);
    ll st = st_hh * 60 + st_mm;
    ll ed = ed_hh * 60 + ed_mm;

    int k;
    cin >> k;
    while (k--)
    {
        ll st1 = st;
        int m;
        ll f1 = 0, f2 = 0, f3 = 0;
        cin >> m;
        while (m--)
        {
           
            string op;
            cin >> op;
            char ch = op[0];
            ll q = stoll(op.substr(1)); // 支持多位数
            if (ch == 'T')
            {
                st1 += t_n3[q];
                f1 = 1;
            }
            else if (ch == 'Z')
            {
                f2 = 1;

                st1 += t_n1[q];
            }
            else
            {
                f3 = 1;
                st1 += t_n2[q];
            }
        }
        if(f1&&f2&&f3)
        {
            if(st1<=ed)
            {
                yes;
            }
            else
                no;
        }
        else
            no;
    }
}

int main()
{
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}